﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Windows.Log.Domain;

namespace Windows.Log.Infrastructure.EFCore
{
    public class LogSignInMapping : IEntityTypeConfiguration<LogSignIn>
    {
        public void Configure(EntityTypeBuilder<LogSignIn> builder)
        {
            builder.Property(x => x.UserName).HasMaxLength(50);
            builder.Property(x => x.SignInOn).HasColumnType("datetime");
            builder.Property(x => x.IP).IsRequired(false).HasMaxLength(200);
            builder.Property(x => x.City).IsRequired(false).HasMaxLength(50);
            builder.Property(x => x.UserAgent).IsRequired(false).HasMaxLength(500);
            builder.Property(x => x.Browser).IsRequired(false).HasMaxLength(200);
            builder.Property(x => x.Os).IsRequired(false).HasMaxLength(200);
            builder.Property(x => x.IsSuccess);
            builder.Property(x => x.ErrorMessage).IsRequired(false);
            builder.Property(x => x.Exception).IsRequired(false);
        }
    }
}
